package com.example.swagger2.test.demo;/*
   
/**
* @program: demo
*
* @description: 用于测试是否该包下的接口都在swagger2上展示
*
* @author: kk
*
* @create: 2020-02-05 11:01
**/

import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

//@ApiOperation(value = "接口说明",httpMethod = "接口请求方式",response = 返回的参数类型,notes = "接口发布说明")
//swagger的接口管理页面:     http://localhost:8080/swagger-ui.html
@RestController
@RequestMapping("/swagger")
public class swagger2TestController {

    @RequestMapping("/index")
    @ApiOperation(value = "测试接口",httpMethod = "GET",response = String.class,notes = "不重要的")
    public String index(String id) {

        return "测试版本。。。";
    }

    @RequestMapping("/indexString")
    @ApiOperation(value = "测试接口2",httpMethod = "GET",consumes ="application/Json",notes = "不重要的2")
    @ResponseBody
    public  Map<String,Object> indexString(String id) {
        Map<String,Object> result=new HashMap<String,Object>();
        result.put("responseCode", 1);
        result.put("msg","成功");
        result.put("data","hahha");
        return result;
    }

    @RequestMapping("/indexObject")
    @ApiOperation(value = "测试对象参数",httpMethod = "POST",consumes ="application/Json",notes = "不重要的2")
    @ResponseBody
    public  Map<String,Object> indexObject(User user) {
        Map<String,Object> result=new HashMap<String,Object>();
        result.put("responseCode", 1);
        result.put("msg","成功");
        result.put("data","hahha");
        return result;
    }
    @RequestMapping("/indexObjectAndString")
    @ApiOperation(value = "测试对象参数hezifu",httpMethod = "POST",consumes ="application/Json",notes = "不重要的2")
    @ResponseBody
    public  Map<String,Object> indexObjectAndString(User user,String ids) {
        Map<String,Object> result=new HashMap<String,Object>();
        result.put("responseCode", 1);
        result.put("msg","成功");
        result.put("data","aaa");
        return result;
    }
}
